package com.zhenmyan.secdeal.rabbitmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * description:
 *
 * @author 颜真明
 * @date 2023/5/15  2:04
 */
@Service
@Slf4j
public class MQSender {

    @Resource
    private RabbitTemplate rabbitTemplate;

    public void send(String message) {
        log.info("normal模式发送消息" + message);
        rabbitTemplate.convertAndSend("queue",  message);
    }

    public void secDealSend(String secDealMessage) {
        log.info("发送秒杀消息" + secDealMessage);
        rabbitTemplate.convertAndSend("sec_deal_topic_exchange", "secDeal",  secDealMessage);
    }


}
